package com.alcatel.staj.janjan.service;

import java.util.ArrayList;
import java.util.List;


import com.alcatel.staj.janjan.model.Departmant;
import com.alcatel.staj.janjan.model.Personel;

public class PersonelForDepartmant {
	List<Personel> personels=new ArrayList<Personel>();
	Personel p1=new Personel();
	Personel p2=new Personel();
	Personel p3=new Personel();
	Departmant d1=new Departmant();
	Departmant d2=new Departmant();
    List<Departmant> departmants=new ArrayList<Departmant>();
    private String departmantName;
	public void getPersonel(int id)
	{
		personels.add(p1);
		personels.add(p2);
		personels.add(p3);
		p1.setName("Reyhan");
		p1.setDepartmantId(1);
		p2.setName("Hikmet");
		p2.setDepartmantId(2);
		p3.setName("Ebru");
		p3.setDepartmantId(1);
		d1.setPersonels(personels);
		
		d1.setId(1);
		d1.setName("bilgisayar");
		d2.setId(2);
		d2.setName("muhasebe");
		departmants.add(d1);
		departmants.add(d2);
		
		for (Personel p : personels) {
			if(p.getDepartmantId()==id)
			{
				for(Departmant d:departmants){
				if(d.getId()==id)
				{
					departmantName=d.getName();
					break;
				}
				}
				System.out.println("name:"+p.getName()+" departmentId:"+p.getDepartmantId()+" departmantName:"+departmantName);
				
			}
		}
	
	}
		public static void main(String[] args)
		{
			try {
				new PersonelForDepartmant().getPersonel(1);
			    } 
			catch (Exception e)
			{
				System.err.println("hata");
			}		
		}
	
		
	
	

}
